# # 创建字典
# a = {}
# b = dict()
# print(type(a))
# print(type(b))

# # 初始化字典
# student = {
#     'id': 12,
#     'name': 'zhangsan'
# }
# print(student)

# # 查找key
# student = {
#     'id': 12,
#     'name': 'zhangsan'
# }
# print('id' in student)
# print('name' in student)
# print('score' in student)
#
# # 根据key获取value
# print(student['id'])
# print(student['name'])


# # 新增/修改元素
# student = {
#     'id': 12,
#     'name': 'zhangsan'
# }
#
#
# student['score'] = 89.5
# print(student)
#
# student['score'] = 90.5
# print(student)

# # 删除元素
# student = {
#     'id': 12,
#     'name': 'zhangsan'
# }
#
# student.pop('id')
# print(student)

# # for循环遍历获取所有字典元素
# student = {
#     'id': 12,
#     'name': 'zhangsan',
#     'score': 99
# }
#
# for key in student:
#     print(key, student[key])


# 使用keys获取字典中所有的key
# student = {
#     'id': 12,
#     'name': 'zhangsan',
#     'score': 99
# }
#
# print(student.keys())
# print(student.values())
# print(student.items())

# # hash
# # 对元组进行hash
# print(hash(1))
# print(hash('hello'))
# print(hash(True))
# print(hash())
# # 对列表进行hash -- error
# print(hash([1, 2, 3]))
# # 对字典进行hash -- error
# print(hash({'id': 1, 'name': 'zhangsan'}))
